class TreeNode():
    def __init__(self,val=0,left=None,right=None):
        self.val=val 
        self.left=left 
        self.right=right

from collections import deque
def build_level(lst):
    root=TreeNode(lst[0])
    que=deque([root])
    i=1 
    while len(que)>0 and i<len(lst):
        cur=que.popleft()
        if lst[i]: 
            cur.left=TreeNode(lst[i])
            que.append(cur.left)
        if i+1<len(lst) and lst[i+1]:
            cur.right=TreeNode(lst[i+1])
            que.append(cur.right)
        i+=2 
    return root 

def traversal_level(root):
    from collections import deque 
    que=deque([root])
    lst=[]
    while(len(que)>0):
        cur=que.popleft()
        if cur:
            lst.append(cur.val)
            que.append(cur.left)
            que.append(cur.right)
        else:
            lst.append(None)
    return lst

def solve(root):
    if not root: return 0 
    return 1+max(solve(root.left),solve(root.right))

root=build_level([3,9,20,None,None,15,7])
print(solve(root))